<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>


<script type="text/javascript" src="${ctx}/js/jquery.itextclear.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $('input[type=text], input[type=password], input[type=url], input[type=email], input[type=number], textarea', '.form').iTextClear();
    });
</script>
<!-- jQplot CSS -->

<link rel="stylesheet" media="screen" href="${ctx}/css/Tree.css"/>
<!-- jQplot CSS END -->

<!-- DATATABLES CSS -->
<link rel="stylesheet" media="screen" href="${ctx}/lib/datatables/css/vpad.css"/>
<script type="text/javascript" src="${ctx}/lib/datatables/js/jquery.dataTables.js"></script>
<!-- DATATABLES CSS END -->

<div class="container_12 clearfix leading">
    <section class="tabs grid_12 leading">
        <ul class="clearfix">
            <s:iterator value="#request.topOrganizations" var="top_o" status="sta">
                <li><a href="javascript:void(0)" class="tab_x" onclick="onTabChange('${top_o.id}')">${top_o.fullName}</a></li>
            </s:iterator>
        </ul>
        <section>
            <s:iterator value="#request.topOrganizations" var="top_o" status="sta">
            <s:if test="#request.organizationId == #request.top_o.id">
            <section class="clearfix" style="display: block;" id="list_content_${top_o.id}"></section>
            </s:if>
            <s:else>
            <section class="clearfix" style="display: none;" id="list_content_${top_o.id}"></section>
            </s:else>
            </s:iterator>
        </section>
    </section>
</div>

<div class="clear"></div>

<script type="text/javascript" src="${ctx}/js/Tree.js"></script>
<script type="text/javascript">
    $(function(){
        setTimeout('onTabChange(${organizationId})', 600);
    });

    function onTabChange(topId){
        var url = "${ctx}${listAction}";
        $.ajax(url, {
            type: "POST",
            data:{"organizationId":topId},
            dataType:"html",
            cache:false,
            success:function(a) {
                var obj = $("#list_content_" + topId);
                obj.html("");
                obj.append(a);
            },
            complete:function() {
            }
        });
    }
</script>